package com.itruth.action;

import java.io.IOException;
import java.io.PrintWriter;

import javax.servlet.http.HttpServletResponse;

import org.apache.struts2.ServletActionContext;

import com.opensymphony.xwork2.ActionSupport;

public class LoginAction extends ActionSupport{

	private static final long serialVersionUID = -1743716162147462510L;
	
	@Override
	public String execute() throws Exception {
		
		return super.execute();
	}
	
	public void login() {
		
		System.out.println("访问成功");
		HttpServletResponse res = ServletActionContext.getResponse();
		res.setCharacterEncoding("UTF-8");
		
		PrintWriter pw = null;
		try {
			pw = res.getWriter();
			pw.write("你妹啊，哈哈");
			pw.flush();
//			pw.close();
		} catch (IOException e) {
			e.printStackTrace();
		}
		
		try {
			pw.write("长连接");
			pw.flush();
			pw.close();
		} catch (Exception e) {
			e.printStackTrace();
		}
		
	}
	
}
